	<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<%@ taglib uri="/resource/UserPwoer.tld" prefix="p"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>

<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
	pageContext.setAttribute("fnId", request.getAttribute("fnId"));
	pageContext.setAttribute("userPwoer", request.getSession().getAttribute("userPwoer"));
%>
<c:set var="path" value="${pageContext.request.contextPath }" />
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport"
	content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<LINK rel="Bookmark" href="../images/favicon.ico">
<!-- 本框架基本脚本和样式 -->
<script type="text/javascript"
	src="${path }/resource/js/jquery-2.1.4.min.js"></script>
<script type="text/javascript"
	src="${path }/resource/js/systools/MBase.js"></script>
<script type="text/javascript"
	src="${path }/resource/js/systools/echarts.js"></script>
<link href="${path }/resource/css/common.css" rel="stylesheet" type="text/css" />
<style type="text/css">
body{
background: radial-gradient(ellipse at 50% 50%,#00a38d 0,#1e5899 100%,#efefef);}
</style>
</head>
<body class="gray-bg" >
	<div class="top-title">
			客户反馈系统
	</div>
	<input type="hidden" value="${param.id}" id="projectId">
	<div class="container m-content">
		
		<h3 class=" text-center">欢迎使用客户反馈系统</h3>
		<a href="${path }/feedback/client/redirect/proble_feedback_list?title=1&projId=${param.id}" class="m-goBack">返回上层</a>
	
	<input type="hidden" id="createTime" value="${obj.createTime}"> 
	<input type="hidden" id="endTime" value="${obj.endTime}"> 
	<div class="row m-mt20">
	  	<div class="col-md-12">
		  	<div class="panel panel-default">
			  <div class="panel-heading"><h2>项目概况</h2></div>
			  <div class="panel-body">
			   <table>
					<tr>
						<th align="right">项目名称：</th><td>&nbsp;${obj.projName}</td>
					</tr>
					<tr>
						<th  align="right">客户信息：</th><td>&nbsp;${obj.client.companyName}</td>
					</tr>
					<tr>
						<th  align="right">对&nbsp;接&nbsp;人&nbsp;：</th><td>&nbsp;${obj.client.contactName}</td>
					</tr>
					<tr>
						<th  align="right">联系方式：</th><td>&nbsp;${obj.client.companyTel}</td>
					</tr>
					
					<tr>
						<th  align="right">立项时间：</th><td>&nbsp;<fmt:formatDate value="${obj.createTime}" type="date"/></td>
					</tr>
					<tr>
						<th  align="right">项目介绍：</th><td>&nbsp;${obj.introduction}</td>
					</tr>
					
					<tr>
						<th  align="right">项目访问地址：</th><td>&nbsp;${obj.url}</td>
					</tr>
					<tr>
						<th  align="right">项目源码地址：</th><td>&nbsp;${obj.gitUrl}</td>
					</tr>
				</table>
			  </div>
		</div>
	  </div>	
	</div>
	
	
	<div class="row">	
		<div class="col-md-12">
			<div class="panel panel-default">
			  <div class="panel-heading"><h2>研发投入</h2></div>
			  <div class="panel-body">
			   		<table style="width: 100%">
				<c:choose>
					<c:when test="${!empty projectUserList}">
						<c:forEach items="${projectUserList}"  var="item">
							<tr>
								<th style="width: 20%;" align="right">${item.postName} :</th>
								<td>&nbsp;${item.userName}</td>
								<%-- <td><fmt:formatDate value="${item.beginTime}" type="date"/> 至
									<c:choose>
										<c:when test="${item.endTime ne null}">
											<fmt:formatDate value="${item.endTime}" type="date"/>
										</c:when>
										<c:otherwise>
											&nbsp;&nbsp; --
										</c:otherwise>
									</c:choose>
								 </td> --%>
							</tr>
						</c:forEach>
					</c:when>
					<c:otherwise>
						暂无数据
					</c:otherwise>
				</c:choose>
			
			</table>
			  </div>
			</div>
		</div>

	</div>
	
	
	

	<%--  <!--  <div class="btn-group " align="right"> -->
	  <p class="text-right">
	  	<c:if test="${obj.status  eq null}">
	  		<input type="button"  class="btn btn-default" onclick="startProj()" value="&nbsp;&nbsp;开始研发&nbsp;&nbsp;">
	  	</c:if>
	  	<c:if test="${obj.status  ne '项目结束'}">
			<input type="button"  class="btn btn-default" onclick="endProj()" value="&nbsp;&nbsp;交付完成&nbsp;&nbsp;">
		</c:if>	
			<!-- <input type="button"  class="btn btn-default" onclick="editor()" value="&nbsp;&nbsp;编辑项目信息&nbsp;&nbsp;">	 -->
	<!--   </div> -->
	</p> --%>

		
	<div>
		<h3>|研发进度信息</h3>
		
		</div>
		<div class="progress">
		  <div class="progress-bar" id="time" role="progressbar" aria-valuenow="${proportion}" aria-valuemin="0" aria-valuemax="100" style="width: ${proportion}%;">
		    ${proportion} %
		  </div>
		</div>	
		
 		<div class="row">
			<div class="col-md-2" align="center">
				<label>总任务：<strong id="taskTotal">&nbsp;</strong></label>	
			</div>
			<div class="col-md-5">
				<div id="echarts1" style="width: 100%;height: 200px"></div>
			</div>
			<div class="col-md-5">
				<div id="echarts2" style="width: 100%;height: 200px"></div>
			</div>
			
		</div>
	</div> 
	<!-- <div>
		<h3>|项目质量信息</h3>
		<div class="row">
			<div id="echarts3" style="width: 100%;height: 200px" class="col-md-10">
		
			</div>
			<div class="col-md-1"></div>
		</div>
		<div class="row">
			<div id="echarts4" style="width: 100%;height: 200px" class="col-md-10">
		
			</div>
			<div class="col-md-1"></div>
		</div>
		<div class="row">
			<div id="echarts5" style="width: 100%;height: 200px" class="col-md-10">
		
			</div>
			<div class="col-md-1"></div>
		</div>
	</div>	 -->
	
</body>
<script type="text/javascript">
	//开始项目
	function startProj(){
		$.AjaxProxy({a : false,c:true,p:{id:$("#projectId").val()}}).invoke("${path}/admin/projectInfo/projStart",function(loj){
			MTools.redirect("${path}/admin/projectInfo/all?id="+$("#projectId").val());
		})
	}
	//交付完成
	function endProj(){
		$.AjaxProxy({a : false,c:true,p:{id:$("#projectId").val()}}).invoke("${path}/admin/projectInfo/projEnd",function(loj){
			MTools.redirect("${path}/admin/projectInfo/all?id="+$("#projectId").val());
		})
	}
	//打开编辑界面
	function editor() {
		layer.open({
			type : 2,
			title : "编辑项目信息",
			area : [ MUI.SIZE_L, '400px' ],
			maxmin : true,
			content : [ '${path}/admin/projectInfo/openEditor?id='+$("#projectId").val()]
		});
	}
	
	$(function(){
		//更新数据库
		$.AjaxProxy({a : true,c : false}).invoke("${path}/admin/projectInfo/qTask",function(loj){});
			//任务进度
		$.AjaxProxy({a : true,c : false,p:{projId:$("#projectId").val()}}).invoke("${path}/admin/projectInfo/queryTask",function(loj){
			$("#taskTotal").empty().html(loj.getRowCount());
			var yTask=0,nTask=0,cTask=0;
			for(var i = 0; i < loj.getRowCount(); i++){
				if(loj.getString(i,"status") =='已完成'){
					yTask ++; //已完成数量
				}else {
					nTask ++;//未完成数量
				}
				
				if(loj.getString(i,"overtime") > 0){
					cTask ++; //超时数据
				}
			}
			var wTask=Number(loj.getRowCount())-Number(cTask);//未超时数量
			var myEcharts1 = echarts.init(document.getElementById("echarts1"));
			myEcharts1.setOption({
				title: {
			        text: '任务完成比率',
			    },
				tooltip: {
			        trigger: 'item',
			        formatter: "{a} <br/>{b}: {c} ({d}%)"
			    },
			    legend: {
			        orient: 'vertical',
			        x: 'left',
			        y: 'bottom',
			        data:['已完成','未完成']
			    },
				  series: [
				             {
				                 name:'任务完成比率',
				                 type:'pie',
				                 radius: ['50%', '70%'],       //内环半径，外环半径
				                 avoidLabelOverlap: false,
				                 itemStyle:{ 
				                     normal:{ 
				                         label:{ 
				                            show: true, 
				                            formatter: '{d}%' 
				                         }, 
				                         labelLine :{show:true}
				                     } 
				                 } ,
				                 data:[
				                     {value:yTask, name:'已完成'},
				                     {value:nTask, name:'未完成'}
				                 ]
				             }
				         ]
			})
			
			//alert(new Date() < new Date($("#endTime").val()) )
			if(new Date() < new Date($("#endTime").val())){
				nTask = loj.getRowCount();
				yTask = 0;
			} 
			
			/* var myEcharts2 = echarts.init(document.getElementById("echarts2"));
			myEcharts2.setOption({
				title: {
			        text: '任务延期比率',
			    },
				tooltip: {
			        trigger: 'item',
			        formatter: "{a} <br/>{b}: {c} ({d}%)"
			    },
			    legend: {
			        orient: 'vertical',
			        x: 'left',
			        y: 'bottom',
			        data:['延期率','未延期率']
			    },
				  series: [
				             {
				                 name:'任务延期比率',
				                 type:'pie',
				                 radius: ['50%', '70%'],       //内环半径，外环半径
				                 avoidLabelOverlap: false,
				                 itemStyle:{ 
				                     normal:{ 
				                         label:{ 
				                            show: true, 
				                            formatter: '{d}%' 
				                         }, 
				                         labelLine :{show:true}
				                     } 
				                 } ,
				                 data:[
				                     {value:cTask, name:'延期率'},
				                     {value:wTask, name:'未延期率'}
				                 ]
				             }
				         ]
			}) */
		
			
		})
	
	})	
	
	
	
	/* $(function(){
		//bug数量
		var bugTotal=0,yBug=0,nBug=0,yqBug=0,cfBug=0,wfBug=0,byBug=0,wbBug=0,sgBug=0,gbBug=0;
		$.AjaxProxy({a : false,c : false,p:{projId:$("#projectId").val()}}).invoke("${path}/admin/projectInfo/queryBug",function(loj){
			bugTotal=loj.getRowCount();
			for(var i = 0; i < loj.getRowCount(); i++){
				if(loj.getString(i,"type") == '已解决'){
					yBug ++;
				}else if(loj.getString(i,"type") == '待解决'){
					nBug ++;
				}else if(loj.getString(i,"type") == '延期处理'){
					yqBug ++;
				}else if(loj.getString(i,"type") == '重复bug'){
					cfBug ++;
				}else if(loj.getString(i,"type") == '无法重现'){
					wfBug ++;
				}else if(loj.getString(i,"type") == '不予解决'){
					byBug ++;
				}else if(loj.getString(i,"type") == '外部原因'){
					wbBug ++;
				}else if(loj.getString(i,"type") == '设计如此'){
					sgBug ++;
				}
				if(loj.getString(i,"status") == '关闭'){
					gbBug++;
				}
			}
			
			var myEcharts3 = echarts.init(document.getElementById("echarts3"));
			myEcharts3.setOption({
				//表头
				title:{
					text: "bug统计 :总数 "+bugTotal,
					subtext:"(bug总数=已解决+未解决+延期处理+重复bug+无法重现+不予解决+外部原因+设计如此)",
					subtextStyle:{
						color :'#C1232B',
					},
						//backgroundColor : '#F3A43B',
				},
				//提示框		
				tooltip:{
					 trigger: 'axis',
					 axisPointer : {            // 坐标轴指示器，坐标轴触发有效
				            type : 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
				     },
				},
				//内容
				 legend: {
			         data:['bug数量']
			     },
			     //x轴坐标
			     xAxis: {
			    	 type : 'category',
			         data: ['已解决','未解决','延期处理','重复bug','无法重现','不予解决','外部原因','设计如此','关闭']
			     },
			     //y轴坐标
			     yAxis: { type : 'value'},
			     //
			     series: [{
			         name: 'bug数量',
			         type: 'bar',
			         itemStyle: {
			                normal: {
			                    color: function(params) {
			                        // build a color map as your need.
			                        var colorList = [
			                          '#C1232B','#C1232B','#C1232B','#C1232B','#C1232B',
			                           '#C1232B','#C1232B','#C1232B','#F3A43B',
			                        ];
			                        return colorList[params.dataIndex]
			                    },
			                   /*  label: {
			                        show: true,
			                        position: 'top',
			                        formatter: '{b}\n{c}'
			                    } 
			                }
			            },
			         data: [yBug, nBug, yqBug, cfBug, wfBug, byBug ,wbBug , sgBug,gbBug]
			     }]
			     
			})
		})
	}) */
	
	$(function(){
		var name=[],totalData=[],data=[];
		var userIdList=[];
		//加载所有的研发人员
		$.AjaxProxy({a : false,c : false,p:{projId:$("#projectId").val()}}).invoke("${path}/admin/projectInfo/queryPostName",function(loj){
			for(var i = 0; i < loj.getRowCount(); i++){
				name[i]=loj.getString(i,"userName");
				userIdList[i]=loj.getString(i,"userId");
			}
		})
		for(var j=0;j<userIdList.length;j++){
			$.AjaxProxy({a : false,c : false,p:{ownerUserId:userIdList[j],projId:$("#projectId").val()}}).invoke("${path}/admin/projectInfo/queryBug",function(loj){
				totalData[j]=loj.getRowCount();//总bug
				var a=0;
				for(var k = 0; k < loj.getRowCount(); k++){
					if(loj.getString(k,"status") == '关闭'){
						a++;
					}
				}
				
				
				
				data[j]=Number(loj.getRowCount())-Number(a); //未解决bug
			})
		}
			var myEcharts4 = echarts.init(document.getElementById("echarts4")); 
			myEcharts4.setOption({
				title:{
					text:"个人bug清单",
					subtext:"(已解决bug != 关闭bug)",
					subtextStyle:{
						color :'#C1232B',
					},
				},
				tooltip:{
					 trigger: 'axis',
					 axisPointer : {            // 坐标轴指示器，坐标轴触发有效
				            type : 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
				     }
					
				},
				legend:{
					data:['总bug','未关闭bug']
				},
				xAxis :[{
					data:name
				}],
				yAxis :[{}],
				series :[
			         {
						name:"总bug",
						type:"bar",
						stack: '数量', //名称相同就可堆叠为一组
						data:totalData,
					 },
					 {
						 name:"未关闭bug",
						 type:"bar",
						 data:data,
					 }
		         ]
			})
	})
	
	//alert(nameList);
	
	$(function(){
		var name=[];
		var score=[];
		//var userIdList=[];
		//加载所有的研发人员
		$.AjaxProxy({a : false,c : false,p:{projId:$("#projectId").val()}}).invoke("${path}/admin/projectInfo/queryPostName",function(loj){
			for(var i = 0; i < loj.getRowCount(); i++){
				name[i]=loj.getString(i,"userName");
				score[i]=loj.getString(i,"score")
				//userIdList[i]=loj.getString(i,"userId");
			}
		})
		//评分
		
		/* for(var j=0;j<userIdList.length;j++){
			$.AjaxProxy({a : false,c : false,p:{userId:userIdList[j],projId:$("#projectId").val()}}).invoke("${path}/admin/projectInfo/queryProjUser",function(loj){
				score[j]=loj.getString(0,"score");
			})
		} */	
		var myEcharts5 = echarts.init(document.getElementById("echarts5"));
		myEcharts5.setOption({
			//表头
			title:{
				text: "代码评分"
			},
			//提示框		
			tooltip:{
				 trigger: 'axis',
				 axisPointer : {            // 坐标轴指示器，坐标轴触发有效
			            type : 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
			     },
			},
			//内容
			 legend: {
		         data:['评审得分']
		     },
		     //x轴坐标
		     xAxis: {
		    	 type : 'category',
		         data : name
		     },
		     //y轴坐标
		     yAxis: { type : 'value'},
		     //
		     series: [{
		         name: '评审得分',
		         type: 'bar',
		         data: score
		     }]
			
		})
	})
	
</script>
</html>		